<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Title</title>
</head>
<body>
<script>
  // 构造函数
  // function Person (name, age) {
  //   this.name = name
  //   this.age = age
  // }
  // Person.prototype.say = function () {
  //   console.log(`${this.name}会说话`)
  // }

  class Person {
    constructor (name, age) {
      this.name = name
      this.age = age
    }
    say () {
      console.log(`${this.name}会说话`)
    }
  }

  let p1 = new Person('Max', 28)
  //console.log(p1)
  p1.say()
</script>
</body>
</html>